﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;
using System.Data;
using System.Text;

namespace IHISCETeim.Web.MachineSys.FXModel
{
    public partial class ReportGetJXSYQ2CSLSBP : PageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "ReportGetJXSYQ2CSLSBP";
            }
        }

        protected string LeaseCompany
        {
            get
            {
                return GetRequestValue<string>("LeaseCompany", "");
            }
        }
        protected string AliasName
        {
            get
            {
                return GetRequestValue<string>("AliasName", "");
            }
        }

        protected int ShowDetail
        {
            get
            {
                return GetRequestValue<int>("ShowDetail", 0);
            }
        }
        protected DataTableCollection dtc1 = null;

        protected void Page_Load(object sender, EventArgs e)
        {
           
            if (ShowDetail == 0)
            {
                if (string.IsNullOrEmpty(LeaseCompany) || string.IsNullOrEmpty(AliasName))
                    return;
                DataTable dt = FXFinanceLeaseController.ReportGetJXSYQ2CSLSBP(AliasName, LeaseCompany);
                this.rpMenu.DataSource = dt;
                this.rpMenu.DataBind();
            }
            else
            {
                dtc1 = FXFinanceLeaseController.ReportGetJXSYQ2CSLSBPTotal();
                this.rpMenu1.DataSource = dtc1[0];
                this.rpMenu1.DataBind();
            }
        }

        protected string GetAliasNameList()
        {
            DataTable aNList = FXFinanceLeaseController.ReportGetAliasNameJXSYQ2CSLSBP(LeaseCompany);
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("<option value='{0}' {2}>{1}</option>", "", "请选择...", "" == AliasName ? "selected" : "");
            foreach (DataRow dr in aNList.Rows)
            {
                sb.AppendFormat("<option value='{0}' {1}>{0}</option>", dr["AliasName"], dr["AliasName"].ToString() == AliasName ? "selected" : "");
            }

            return sb.ToString();
        }
    }
}